package com.cal.utms.action.user_maintenance;

import com.cal.utms.core.MenuModel;
import com.cal.utms.dao.user_maintenance.UserDaoImpl;
import com.cal.utms.dto.user_maintenance.MenuScreenDto;
import com.cal.utms.model.user_maintenance.MenuScreenModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class MenuScreenAction extends ActionSupport implements ModelDriven<MenuScreenDto> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private MenuScreenDto menuScreenDto = new MenuScreenDto();
	private int groupid;
	UserDaoImpl daoImpl = new UserDaoImpl();

	MenuModel menuModel = new MenuModel();

	public String getMenus() {
		menuScreenDto.setMenuScreenDtos(MenuScreenModel.createListModel(daoImpl.getAllMenus()));
		return Action.SUCCESS;
	}

	public String getMenuIdsByGroup() {
		menuScreenDto.setMenuIds(menuModel.getMenuIdByGroupId(groupid));
		return Action.SUCCESS;
	}

	@Override
	public MenuScreenDto getModel() {
		return menuScreenDto;
	}

	public MenuScreenDto getMenuScreenDto() {
		return menuScreenDto;
	}

	public void setMenuScreenDto(MenuScreenDto menuScreenDto) {
		this.menuScreenDto = menuScreenDto;
	}

	public int getGroupid() {
		return groupid;
	}

	public void setGroupid(int groupid) {
		this.groupid = groupid;
	}

}
